#include <linux/module.h>
#include <linux/firmware.h>
#include <linux/device.h>

#define SLAM_TEST_FIRMWARE "rt73.bin"
static const struct firmware * fwp;

static struct device slam_device = {
	.init_name = "slam0",
};

static void print_firmware_data(char * fw, int size)
{
	u8 buf[size+1];
	memcpy(buf, fw, size);
	buf[size] = '\0';
	printk("firmware data:%x\n", buf);
}

static __init int firmware_operate_init(void)
{
	int ret = 0;

	device_initialize(&slam_device);

	ret = request_firmware(&fwp, SLAM_TEST_FIRMWARE, &slam_device);
	if (ret) {
		printk("Load firmware failed!\n");
		return -1;
	}

	print_firmware_data(fwp->data, fwp->size);

	release_firmware(fwp);

	return 0;
}

static __exit void firmware_operate_exit(void)
{
	printk("%s\n", __func__);
}

module_init(firmware_operate_init);
module_exit(firmware_operate_exit);

MODULE_AUTHOR("xinu");
MODULE_LICENSE("GPL");
MODULE_FIRMWARE(SLAM_TEST_FIRMWARE);
